package vn.egame.elockscreen.object;

import vn.egame.elockscreen.utils.Constans;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;

public class Texture extends BaseActor {

	private Context mContext;
	private Bitmap texture;

	public Texture(Context context, int resouce) {
		mContext = context;
		texture = Constans.loadBitmap(mContext, resouce);
		setWidth(texture.getWidth());
		setHeight(texture.getHeight());
	}

	public Texture(Context context, String zipFilePath, String imageFileInZip) {
		mContext = context;
		// texture = Constans.loadBitmapFromSdcard(photoPath);
//		 texture = Constans.getBtimapFromZip(zipFilePath, imageFileInZip);
		texture = Constans.getBitmapFromAsset(context, zipFilePath
				+ imageFileInZip);
		setWidth(texture.getWidth());
		setHeight(texture.getHeight());
	}

	public void onDraw(Canvas canvas, int x, int y) {

		Rect src = new Rect(0, 0, getWidth(), getHeight());
		Rect dst = new Rect(x, y, x + getWidth(), y + getHeight());

		canvas.drawBitmap(getTexture(), src, dst, null);

	}

	// public boolean isCollition(float x2, float y2) {
	//
	// return x2 > x && x2 < x + width && y2 > y && y2 < y + height;
	//
	// }

	public Bitmap getTexture() {
		return texture;
	}

	public void setTexture(Bitmap texture) {
		this.texture = texture;
	}

}
